<extend name="Public/base"/>
<block name="body">
    <style>
      .img {
        width: 370px;
        height: 200px;
        border: 0 none;
        float: left;
        object-fit: cover;
        margin-right: 10px;
      }

      .yyzz {
        width: 300px;
        height: 500px;
        object-fit: cover;
      }
    </style>

    <script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    <div class="main-title">
        <h2>{$meta_title}</h2>
    </div>

    <form action="" method="post" class="form-horizontal">
        <!--  机构名称  -->
        <div class="form-item">
            <label class="item-label">机构名称</label>
            <div class="controls">
                <input type="text" class="text input-large" name="name" value="{$info.name}">
            </div>
        </div>

        <notempty name="info.banner">
            <!--  banner图  -->
            <div class="form-item">
                <label class="item-label">banner图</label>
                <div class="controls">
                    <volist name="info['banner']" id="vo">
                        <img class="img" src="{$vo.path}"/>
                    </volist>
                </div>
            </div>
        </notempty>

        <!--  负责人姓名  -->
        <div class="form-item">
            <label class="item-label">负责人姓名</label>
            <div class="controls">
                <input type="text" class="text input-large" name="username" value="{$info.username}">
            </div>
        </div>
        <!--  负责人电话  -->
        <div class="form-item">
            <label class="item-label">负责人电话</label>
            <div class="controls">
                <input type="text" class="text input-large" name="mobile" value="{$info.mobile}">
            </div>
        </div>
        <!--  身份证号码  -->
        <div class="form-item">
            <label class="item-label">身份证号码</label>
            <div class="controls">
                <input type="text" class="text input-large" name="id_card" value="{$info.idcard}">
            </div>
        </div>
        <!--  分成比例  -->
        <div class="form-item">
            <label class="item-label">分成比例<span class="check-tips">（请输入大于0小于100的数值）</span></label>
            <div class="controls">
                <input type="number" class="text input-large" name="profit_rate" value="{$info.profit_rate}">
            </div>
        </div>
        <!--  身份证正面  -->
        <div class="form-item">
            <div class="controls">
                <label class="item-label">身份证正面<span class="check-tips">（推荐尺寸：750px * 360px；上传图片支持 jpg、png格式，图片最大支持200KB）</span></label>
                <input type="file" id="img_card_front" style="display: none">
                <input type="hidden" name="card_front" id="card_front" value="">
                <img class="upload-file img" src="/Uploads/Picture/uploadBtn.png" id="uploadCardFrontImg">
                <script type="text/javascript">
                    $("#uploadCardFrontImg").click(function (){
                        $("#img_card_front").trigger("click");
                    })
                    $('#img_card_front').change(function (){
                        var pic = $(this)[0].files[0];
                        var formData = new FormData();
                        var url="{:U('File/uploadPicture',array('session_id'=>session_id()))}";
                        formData.append('download', pic);
                        $.ajax({
                            url:url,
                            type:"post",
                            data: formData,
                            cache: false,
                            contentType: false,
                            processData: false,
                            success:function(data){
                                if(data.status == 1){
                                    //上传成功
                                    var id = data.id;
                                    var path = data.path;

                                    $('#card_front').val(id);
                                    $('#uploadCardFrontImg').attr('src', path);
                                }else{
                                    layer.msg(data.info);
                                }
                            }
                        });
                    });
                </script>
            </div>
        </div>


        <!--  身份证反面  -->
        <div class="form-item">
            <div class="controls">
                <label class="item-label">身份证反面<span class="check-tips">（推荐尺寸：750px * 360px；上传图片支持 jpg、png格式，图片最大支持200KB）</span></label>
                <input type="file" id="img_card_behind" style="display: none">
                <input type="hidden" name="card_behind" id="card_behind" value="">
                <img class="upload-file img" src="/Uploads/Picture/uploadBtn.png" id="uploadCardBehindImg">
                <script type="text/javascript">
                    $("#uploadCardBehindImg").click(function (){
                        $("#img_card_behind").trigger("click");
                    })
                    $('#img_card_behind').change(function (){
                        var pic = $(this)[0].files[0];
                        var formData = new FormData();
                        var url="{:U('File/uploadPicture',array('session_id'=>session_id()))}";
                        formData.append('download', pic);
                        $.ajax({
                            url:url,
                            type:"post",
                            data: formData,
                            cache: false,
                            contentType: false,
                            processData: false,
                            success:function(data){
                                if(data.status == 1){
                                    //上传成功
                                    var id = data.id;
                                    var path = data.path;

                                    $('#card_behind').val(id);
                                    $('#uploadCardBehindImg').attr('src', path);
                                }else{
                                    layer.msg(data.info);
                                }
                            }
                        });
                    });
                </script>
            </div>
        </div>
        <!--  手持身份证  -->
        <div class="form-item">
            <div class="controls">
                <label class="item-label">手持身份证<span class="check-tips">（推荐尺寸：750px * 360px；上传图片支持 jpg、png格式，图片最大支持200KB）</span></label>
                <input type="file" id="img_hold_card" style="display: none">
                <input type="hidden" name="hold_card" id="hold_card" value="">
                <img class="upload-file img" src="/Uploads/Picture/uploadBtn.png" id="uploadHoldCardImg">
                <script type="text/javascript">
                    $("#uploadHoldCardImg").click(function (){
                        $("#img_hold_card").trigger("click");
                    })
                    $('#img_hold_card').change(function (){
                        var pic = $(this)[0].files[0];
                        var formData = new FormData();
                        var url="{:U('File/uploadPicture',array('session_id'=>session_id()))}";
                        formData.append('download', pic);
                        $.ajax({
                            url:url,
                            type:"post",
                            data: formData,
                            cache: false,
                            contentType: false,
                            processData: false,
                            success:function(data){
                                if(data.status == 1){
                                    //上传成功
                                    var id = data.id;
                                    var path = data.path;

                                    $('#hold_card').val(id);
                                    $('#uploadHoldCardImg').attr('src', path);
                                }else{
                                    layer.msg(data.info);
                                }
                            }
                        });
                    });
                </script>
            </div>
        </div>

        <!--  机构介绍  -->
        <div class="form-item">
            <label class="item-label">机构介绍</label>
            <div class="controls">
                <label class="textarea input-large" style="width: 1250px;">
                    <textarea name="desc">{$info.desc}</textarea>
                    {:hook("adminArticleEdit", array("name"=>desc,"value"=>$info["desc"]))}
                </label>
            </div>
        </div>
        <input type="hidden" value="{:I('id')}" name="id"/>
        <div class="form-item">
            <button class="btn submit-btn ajax-post" id="submit" type="submit" target-form="form-horizontal">确 定</button>
            <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
        </div>
    </form>
</block>

<block name="script">
    <script type="text/javascript">
        //导航高亮
        highlight_subnav('{:U("Manage/institutionList")}');
    </script>
</block>
</html>